<template>
    <div>
        <div class="top">
            <img :src="img" alt="">
            <p>{{title}}</p>
            <div class="left">
                <span>{{bedroom}}室{{livingroom}}厅{{toilet}}卫</span>
                <span>{{buildarea}}m²</span>
            </div>
            <div class="right">
                <span>{{heading}}</span><span>{{sqname}}</span><span>{{qyname}}</span>
            </div>
        </div>
        <p class="recommend">推荐房源</p>
        <div class="main">
            <div v-for="item in list.list" :key="item.cityid">
                <img :src="item.imgurl" alt="">
                <p>{{item.communityname}}</p>
                <span v-for="(ite,ind) in item.tagwall" :key="ind">{{ite}}</span>
            </div>
        </div>
    </div>    
</template>

<script>
import {getlist} from '@/services'
export default {
    data(){
        return{
            title:'',
            img:'',
            bedroom:'',
            livingroom:'',
            qyname:'',
            buildarea:'',
            heading:'',
            toilet:'',
            sqname:'',
            list:[],
        }
    },
 onLoad(ev){
     this.img=ev.img
     this.title=ev.title
     this.bedroom=ev.bedroom
     this.livingroom=ev.livingroom
     this.toilet=ev.toilet
     this.buildarea=ev.buildarea
     this.heading=ev.heading
     this.qyname=ev.qyname
     this.sqname=ev.sqname
 },
 async created(){
    let result=await getlist()
    if(result.status==200){
        
        this.list=result.data
    }
    console.log(result.data.list)
 }
} 
</script>

<style lang="scss" scoped>
    .top{
        >p{
            font-size: 15px;
            padding: 2px 10px;
            line-height: 30px;
        }
        >div{
            margin-left: 10px;
            line-height: 30px;
        }
        .left{
            display: flex;
            justify-content: space-around;
            span{
                margin:20px 0px;
                border-right: 1px solid #eee;
                padding-right:10px; 
                color:red;
                font-size: 20px;
            }
        }
        .right{
           span{
                background: #eee;
                color:#666;
                font-size: 13;
                margin-right: 3px;
                margin-left: 7px;
           }
        }
    }
    .main{
        display: flex;
        flex-wrap: wrap;
        justify-content: space-around;
        >div{
            width: 40%;
        }
            
            img{
                width: 120px;
                height: 120px;
                border-radius: 3px;
                margin: 2px;
            }
            p{
                font-size: 12px;
            }
            span{
                
                color:#666;
                margin-right: 3px;
                font-size: 10px;
            }
        }
    .recommend{
        font-size: 20px;
        margin: 10 10px;
        line-height: 40px;
        border-bottom: 1px solid #999;
    }
</style>
